﻿namespace PersonalWebsite.Core.Exceptions;

public class VaildateException : Exception
{
    private readonly VaildateResult[] _vaildateResults;

    public IReadOnlyCollection<VaildateResult> Errors { get { return _vaildateResults; } }

    public VaildateException(VaildateResult[] vaildateResults)
    {
        _vaildateResults = vaildateResults;
    }

    public VaildateException(VaildateResult vaildateResult)
    {
        _vaildateResults = new VaildateResult[] { vaildateResult };
    }

    public VaildateException(string propName, string error)
    {
        _vaildateResults = new VaildateResult[] { new VaildateResult(propName, error) };
    }
}

public sealed class VaildateResult
{
    public VaildateResult(string property, string error)
    {
        Property = property;
        Error = error;
    }

    public string Property { get; private set; }

    public string Error { get; private set; }
}
